/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-10-26
 * Time: 11:41
 */
public class test1 {
    public static int cutRope (int n) {
        // write code here
        // 两个条件：相加等于n，相乘得最大
        if(n<=3){
            return n-1;
        }
        int a = n/3;
        int b = n%3;
        if(b==1){
            a--;
            b = 2;
        }
        return ((int)Math.pow(3,a) * (int)Math.pow(2,b))/2;
    }

    public static void main(String[] args) {
        int a = cutRope(8);
        System.out.println(a);
    }
}
